package spil;

import boundaryToMatador.GUI;
import static spil.Text.*; // Importerer alle static variabler i klassen Text.java

public class GameBoard {

	private Felt[] felt;

	public GameBoard(){
	}
	
	// Metode som tilretter GUI'en til vores felter
	public void guiSetup(){
		GUI.setTitleText(1,"Start"); // Start-feltet
		GUI.setSubText(1, "");
		GUI.setDescriptionText(1,"");
		
		GUI.setTitleText(2,"Tower"); 
		GUI.setSubText(2, "+250"); 
		GUI.setDescriptionText(2, TOWER);
		
		GUI.setTitleText(3,"Crater");
		GUI.setSubText(3, "-200");
		GUI.setDescriptionText(3, CRATER);
		
		GUI.setTitleText(4,"Palace Gates");
		GUI.setSubText(4, "-100");
		GUI.setDescriptionText(4, PALACEGATES);
		
		GUI.setTitleText(5,"Cold Desert");
		GUI.setSubText(5, "-20");
		GUI.setDescriptionText(5, COLDDESERT);
		
		GUI.setTitleText(6,"Walled city");
		GUI.setSubText(6, "+180");
		GUI.setDescriptionText(6, WALLEDCITY);
		
		GUI.setTitleText(7,"Monastary");
		GUI.setSubText(7, "0");
		GUI.setDescriptionText(7, MONASTARY);
		
		GUI.setTitleText(8,"Black cave");
		GUI.setSubText(8, "-70");
		GUI.setDescriptionText(8, BLACKCAVE);
		
		GUI.setTitleText(9, "Huts in the Mountain"); 
		GUI.setSubText(9, "-60"); 
		GUI.setDescriptionText(9, HUTSINTHEMOUNTAIN); 
		
		GUI.setTitleText(10, "The Werewall"); 
		GUI.setSubText(10, "-80" + EKSTRASLAG); // Spilleren får et ekstraslag når man lander på dette felt - dette fremgår naturligvis af feltet
		GUI.setDescriptionText(10, THEWEREWALL); 
		
		GUI.setTitleText(11, "The Pit"); 
		GUI.setSubText(11, "-90"); 
		GUI.setDescriptionText(11, THEPIT); 
		
		GUI.setTitleText(12, "Goldmine"); 
		GUI.setSubText(12, "+650"); 
		GUI.setDescriptionText(12, GOLDMINE); 
		
		/*
		 *  Vi 'blanker' resten af felterne i GUIen så de ikke forstyrrer
		 */
		for (int i=13; i<=40; i++){
			GUI.setTitleText(i,"");
			GUI.setSubText(i, "");
			GUI.setDescriptionText(i,"");
		}
	}
	
	// Metode som opretter felterne på spillepladen (bestående af felter med text)
	public void feltSetup() {
		
		Felt f2 = new Felt("Tower", 250, TOWER);
		Felt f3 = new Felt("Crater", -200, CRATER);
		Felt f4 = new Felt("Palace Gates", -100, PALACEGATES);
		Felt f5 = new Felt("Cold Desert", -20, COLDDESERT);
		Felt f6 = new Felt("Walled city", 180, WALLEDCITY);
		Felt f7 = new Felt("Monestary", 0, MONASTARY);
		Felt f8 = new Felt("Black cave", -70, BLACKCAVE);
		Felt f9 = new Felt("Huts in the Mountain", -60, HUTSINTHEMOUNTAIN);
		Felt f10 = new Felt("The Werewall", -80, THEWEREWALL);
		Felt f11 = new Felt("The Pit", -90, THEPIT);
		Felt f12 = new Felt("Goldmine", 650, GOLDMINE);

		// Vi opretter to tomme felter, som bruges til at sikre vores felt nr. 2 (Tower) kan kaldes med felt[2]
		Felt f0 = new Felt("", 0, "");
		Felt f1 = new Felt("Start", 0, "");

		// Indsætter værdier i arrayet af Felter med de oprettede felt-objekter
		felt = new Felt[]{f0,f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12};
	}
	
	// Metode til at hente konsekvens for et specifikt felt
	public int getConsequence(int i){
		return felt[i].getConsequence();
	}
	
	// Henter beskrivelsen for felt nummer i
	public String getDescriptionText(int i) {
		return felt[i].getDescriptionText();
	}
	
	public void print(int i){
		felt[i].print();
	}
	
	public void setDescriptionText(int i, String desc){
		felt[i].setDescriptionText(desc);
	}
	
	public void setTitleText(int i, String desc){
		felt[i].setTitleText(desc);
	}
}
